<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>添加货币</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <script src="../../script/vue.min.js"></script>
    <script src="../../script/fastclick.js"></script>
    <style>
    .header2 {
        background: #fbdb0a;
        color: #000;
    }

    .aui-bar-nav .aui-iconfont {
        color: #000;
    }
    </style>
</head>

<body>
    <div id="cell" v-cloak>
        <header class="aui-bar aui-bar-nav header2" id="header2">
            <a class="aui-pull-left" @click="goBack()">
              <span class="aui-iconfont aui-icon-left"></span>
            </a>
            <div class="aui-title">添加货币</div>
        </header>
        <div class="cell-box">
            <div class="aui-content aui-margin-b-15">
                <ul class="aui-list aui-list-in">
                    <li class="aui-list-item" v-for="(item, index) in rataData" :key="index" @click="selected(item)">
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-title">{{item.zh}} {{item.en}}</div>
                            <div class="aui-list-item-right">{{item.isSelect}}</div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</body>
<script src="../../script/api.js"></script>
<script>
apiready = function() {
  FastClick.attach(document.body);
    header = $api.byId('header2');
    //适配iOS 7+，Android 4.4+状态栏
    $api.fixStatusBar(header);
    api.addEventListener({
        name: 'keyback'
    }, function(ret, err) {
        api.openWin({
            name: 'home',
            url: 'home.html'
        });
    });
    var vm = new Vue({
        el: '#cell',
        data: {
            list: [],
            rataData: []
        },
        methods: {
            selected: function(item) {
                for (var i = 0; i < this.rataData.length; i++) {
                    if (item.en === this.rataData[i].en) {
                        this.rataData[i].isSelect = '已选'
                    }
                }
                $api.setStorage('rataData', this.rataData)
                // api.closeWin({
                //     name: 'home'
                // });
                var jsfun = 'funcGoto();';
                api.execScript({
                    name: 'home',
                    frameName: 'index',
                    script: jsfun
                });
            },
            goBack: function() {
                api.openWin({
                    name: 'home',
                    url: 'home.html'
                });
            },
        },
        mounted: function() {
            this.rataData = api.pageParam.rataData
        }
    })
}
</script>

</html>
